<link rel="stylesheet" type="text/css" href="../addons/jy_merch/resource/css/list.css?v=2">
<div ng-include="sys_html('common/_header')"></div>
<style>
    .yen{border:none;height:0.75rem;width:0.75rem;display: inline-block;background: #ff4753;color:#fff;font-size:0.4rem;line-height: 0.8rem;text-align: center;
        font-style: normal;border-radius: 0.75rem;-webkit-border-radius: 0.75rem;}
    .order-create-page .fui-list.goods-item .fui-list-inner{
        height: 3.5rem;
        align-self: center;
    }
    .order-create-page .fui-list.goods-item .fui-list-angle{
        height: 3.5rem;
        align-self: center;
    }
    .order-create-page .fui-list-inner .subtitle{
        display: block;
    }
    .fui-header a.back2:before {
        content: " ";
        display: inline-block;
        -webkit-transform: rotate(45deg);
        -ms-transform: rotate(45deg);
        transform: rotate(45deg);
        height: 0.5rem;
        width: 0.5rem;
        border-width: 0 0 2px 2px;
        border-color: #666;
        border-style: solid;
        position: relative;
        top:0;
    }
.fui-btn-c {
    height: auto;
    margin: 0;
    padding: 0.4rem;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
	justify-content:center;
    align-items: center;
    position: relative;
}

.fui-btn-c .icon {
	font-size:1rem;
	padding-right:0.3rem;
	text-align:right;
}

.fui-btn-c .info {
	text-align:left;
    padding-right: 0.2rem;
    font-size: 0.75rem;
}

.fui-btn-c .info p {
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}
.jylabel-red-0.active::after{content:" ";width:23px;height:24px;background:url(../core/resource/images/gou-yellow.png) no-repeat;position:absolute;float:right;right:-1px;bottom:-1px;text-align:center;background-color:#fbf4e4;}
.parent-category{float:left; width:100%; height:auto; min-height:100%;}
.parent-category ul{margin:0; padding:0; width:100%;}
.parent-category ul li{list-style:none; text-align:center; height:50px; line-height:50px; white-space:nowrap; width:100%; border-bottom:1px solid #e0e0e0; position:relative; right:-1px;}
.parent-category ul li.active{border-right:1px solid #fff; z-index: 10000}
.parent-category ul li a{color:#333; display:inline-block; width:100%; height:100%; text-decoration:none;}
.parent-category ul li.active a{color:#ffa000;}
.children-category{width:100%; min-height:100%; height:auto; color: #252525;}
.children-category ul{list-style:none; margin:0; padding:0; overflow-y:auto; overflow-x:hidden; border-left:1px solid #e0e0e0; min-height:100%;}
.children-category ul li{text-align:left; height: 32px; line-height: 32px; padding-left: 15px}
.children-category ul li.delivery-tips{height:25px; line-height:25px; margin-top: -15px; font-size: .65rem; color: #ff2d4b}
.children-category ul li a{display:inline-block; width:100%; height:100%; text-decoration:none; color:#333;}
.children-category ul li a span{font-size: .6rem; color: #999;}
.children-category .block{display:block; color:#ef1e15; font-size:.6rem;}
.fui-tab.fui-tab-danger a.active {
    border-color: #ffa000;
}
.fui-navbar .cartbtn {padding-right:0.3rem;background:#fff;opacity:1}
.fui-navbar .buybtn  {padding-left:0.3rem;background:#fff}
.fee-tag-nav, .fee-tagup-nav, .fee-disabled-nav {border-radius:1rem;height:2rem;line-height:2rem;color:#fff;width:100%;font-weight:400;font-size:0.7rem;margin:0.2rem 0;padding:0 0.2rem}
.fee-tagup {background:{{main.syscolor || 'red'}};color:#fff;width:auto;font-weight:400;font-size:0.55rem}
.fee-tag-nav {background:{{main.syscolor || 'red'}}; opacity: 0.58;}
.fee-tagup-nav {background:{{main.syscolor || 'red'}};}
.fee-disabled-nav {background:#bbb;color:#fff;}	
</style>
<div class='fui-page order-create-page'>
    <div class='fui-content'>
		<div ng-if="pagedata.sendtypes && !pagedata.sendtypeone" id="carrierTab" class="fui-tab fui-tab-danger" style="margin-bottom: 0">
            <a ng-repeat="(k,v) in pagedata.sendtypes" ng-class="{'active':pagedata.post.sendtype==k}" ng-click="pagedata.post.sendtype=k">{{v}}</a>
        </div>
		<!--地址选择-->
		<div id="addressInfo" ng-show="pagedata.post.sendtype==1" class="fui-cell-group fui-address-group" style="margin-top:0px;margin-bottom:0;background:#fff">
			<div ng-if="pagedata.post.addressid" class="fui-cell" ng-click="pagedata.get_addresslist()">
				<div style="width:100%">
					<div class="fui-cell-text name bold" style="font-size:0.8rem">
						<span style="margin-right:20px">{{pagedata.item.address.name}}</span><span>{{pagedata.item.address.mobile}}</span>
					</div>
					<div class="fui-cell-text name" style="margin-top:5px">	
						<i class="fui-tag fui-tag-red">默认</i>
						<i class="fui-tag fui-tag-blue" style="margin-left:0.1rem">家</i>
						{{pagedata.item.address.pcd.province||''}} {{pagedata.item.address.pcd.city ||''}} {{pagedata.item.address.pcd.district||''}} {{pagedata.item.address.address ||''}}
					</div>
				</div>
				<div class="fui-cell-remark"></div>
			</div>
			<div ng-if="!pagedata.post.addressid" class="fui-cell">
				<div class="fui-list-inner" ng-click="pagedata.edit_address=1">
						<div class="text no-address" ><i class="icon jinyunicon icon-tianjia"></i> {{pagedata.item.isnoarea==1?'默认地址不在配送范围,需另加':'添加收货地址'}}</div>
				</div>
			</div>
			<div class="fui-cell" href="javascript:;" ng-click="pagedata.showstoreitem();" style="padding-top:0.55rem">
						<div class="fui-cell-label" style="width:auto">
							<i class="icon icon-map"></i> 商户：
						</div>
						<div class="fui-cell-info">
							<span>{{pagedata.selectstore.merchname}}</span> <span class="red">{{pagedata.selectstore.pcd.city || ''}}</span>({{pagedata.selectstore.pcd.district || ''}} {{pagedata.selectstore.pcd.street || ''}})
						</div>
						<div class="fui-cell-remark">
						</div>
			</div>
		</div>
<!--自提点选择-->
    <div ng-show="pagedata.post.sendtype==2 || pagedata.post.sendtype==3">
		<div class="fui-list-group"  id="carrierInfo" style="margin: 0 0 0.5rem">
					<a class="fui-list" href="javascript:;" ng-click="pagedata.showstorelist();">
						<div class="fui-list-media">
							<i class="icon icon-map"></i>
						</div>
						<div class="fui-list-inner">
							<div class="text bold">
								<span style="overflow: hidden;display: inline-block;">{{pagedata.pluginset.qucaititle}}门店：</span>
								<span class='realname'>{{pagedata.selectstore.merchname}}</span>
								
							</div>
							<div class="text address">地址：<span class="red">{{pagedata.selectstore.pcd.city || ''}}</span>({{pagedata.selectstore.pcd.district || ''}} {{pagedata.selectstore.pcd.street || ''}} {{pagedata.selectstore.address || ''}})</div>

						</div>
						<div class="fui-list-angle">
							<div class="angle"></div>
						</div>
					</a>
		</div>
        <div class="fui-cell-group sm" id="memberInfo" ng-show="false">
                <div class="fui-cell">
                    <div class="fui-cell-label sm">联系人</div>
                    <div class="fui-cell-info c000"><input type="text" placeholder="请输入联系人" class="fui-input" ng-model="pagedata.post.realname"/></div>
                </div>
                <div class="fui-cell">
                    <div class="fui-cell-label sm">联系电话</div>
                    <div class="fui-cell-info c000"><input type="tel" placeholder="请输入联系电话"  class="fui-input" ng-model="pagedata.post.mobile"/></div>
                </div>
        </div>
	</div>
	<div class="fui-cell-group"  style="margin-top:0">
		<div ng-if="pagedata.order.oldorderid" class="fui-cell-title bold" style="padding: 0.5rem 0.65rem;">已点商品明细</div>
		<div ng-repeat="item in pagedata.order.list" ng-if="item.isold==1" class="fui-cell">
				<div class="fui-cell-text">
					{{item.title}}<span ng-if="item.optiondata">({{item.optiondata}})</span>
				</div>
				<div class="fui-cell-remark noremark">
					 <span ng-if="item.active.title" class='red' style="font-size:0.65rem;font-weight:400"> {{item.active.title}}</span><span ng-if="!item.active.price">￥ {{item.price}}</span> <span ng-if="item.active.price" class='marketprice'>{{item.active.price}}</span><span class="subtitle" style="margin-left:0.2rem">x{{item.total}}</span>
				</div>
		</div>
		<div ng-if="pagedata.order.cart_num>0" class="fui-cell-title bold" style="padding: 0.5rem 0.65rem;">{{pagedata.order.oldorderid?'追加':''}}商品明细</div>
		<div ng-repeat="item in pagedata.order.list" ng-if="item.isold!=1" class="fui-cell">
				<div class="fui-cell-text">
					{{item.title}}<span ng-if="item.optiondata">({{item.optiondata}})</span>
				</div>
				<div class="fui-cell-remark noremark">
					 <span ng-if="item.active.title" class='red' style="font-size:0.65rem;font-weight:400"> {{item.active.title}}</span><span ng-if="!item.active.price">￥ {{item.price}}</span> <span ng-if="item.active.price" class='marketprice'>{{item.active.price}}</span><span class="subtitle" style="margin-left:0.2rem">x{{item.total}}</span>
				</div>
		</div>
		<div ng-repeat="item in pagedata.gifts" class="fui-cell">
				<div class="fui-cell-text">
					{{item.title}}<span class="fui-label fui-label-danger">赠品</span>
				</div>
				<div class="fui-cell-remark noremark">
					<span class="bold oldprice">￥ {{item.price || '0.00'}}</span> <span class="subtitle" style="margin-left:0.2rem">x1</span>
				</div>
		</div>
		<div class="fui-cell">
				<div class="fui-cell-info">
					<span class="r-f bold" style="color:#000;">共{{pagedata.order.total}}件，小计：<span class="price red">￥{{price(pagedata.order.total_price) || '0.00'}}</span></span>
				</div>
		</div>
	</div>
	<div class="fui-cell-group">
		<div class="fui-cell" ng-if="pagedata.post.invoice =='1'">
			<div class="fui-cell-label" style="width:100px">发票抬头</div>
			<div class="fui-cell-text bold r"><span class="red">电子</span>({{pagedata.post.invoicegoodstype !=2?'商品明细':'商品类别'}}-{{pagedata.post.fapiaotype2 !=2?'个人':'单位'}})</div>
			<div class="fui-cell-remark" onclick="$('#showfapiao').modal();" ng-click=""></div>
		</div>
		<div id='coupondiv' class="fui-cell fui-cell-click">
			<div class='fui-cell-label' style='width:auto;'>优惠券</div>
		<div class='fui-cell-text bold r'>{{pagedata.post.title5 || ''}}</div>
		<div class="fui-cell-remark" onclick="$('#showcoupon').modal();">
			<div ng-if="pagedata.coupons.length>1" class="badge">{{pagedata.coupons.length}}</div>
			<span ng-if="pagedata.coupons.length<=0" class='text'>无可用</span>
		</div>
	</div>
		<div class="fui-cell" onclick="$('#showremark').modal();">
			<div class="fui-cell-label" style="width:100px">买家留言</div>
			<div class="fui-cell-text bold r"><span ng-model="pagedata.item.remark" class="red">选填</span>({{pagedata.post.remark ? pagedata.post.remark :'50字以内:亲,加急哦!'}})</div>
			<div class="fui-cell-remark" ></div>
		</div>
	</div>

<div class="fui-cell-group">
	<div ng-if="pagedata.order.taskdiscountprice" class="fui-cell istaskdiscount">
        <div class="fui-cell-label" style='width:auto' >任务活动优惠</div>
        <div class="fui-cell-info"></div>
        <div class="fui-cell-remark noremark bold">-&yen; <span class='dispatchprice'>{{price(pagedata.order.taskdiscountprice)}}</span></div>
    </div>
    <div ng-if="pagedata.order.taskcut>0" class="fui-cell taskcut" >
        <div class="fui-cell-label" style='width:auto' >任务中心优惠</div>
        <div class="fui-cell-info"></div>
        <div class="fui-cell-remark noremark bold">-&yen; <span class='dispatchprice'>{{price(pagedata.order.taskcut)}}</span></div>
    </div>

    <div ng-if="pagedata.order.lotterydiscountprice>0" class="fui-cell islotterydiscount">
        <div class="fui-cell-label" style='width:auto' >游戏活动优惠</div>
        <div class="fui-cell-info"></div>
        <div class="fui-cell-remark noremark bold">-&yen; <span class='dispatchprice'>{{price(pagedata.order.lotterydiscountprice)}}</span></div>
    </div>

    <div ng-if="pagedata.order.level_de_price>0" class="fui-cell discount">
        <div class="fui-cell-label" style='width:auto' >会员优惠</div>
        <div class="fui-cell-info"></div>
        <div class="fui-cell-remark noremark bold">-&yen; <span class='dispatchprice'>{{price(pagedata.order.level_de_price)}}</span></div>
    </div>
	<div ng-if="pagedata.order.luck_de_price>0" class="fui-cell discount">
        <div class="fui-cell-label" style='width:auto' >运势优惠</div>
        <div class="fui-cell-info"></div>
        <div class="fui-cell-remark noremark bold">-&yen; <span class='dispatchprice'>{{price(pagedata.order.luck_de_price)}}</span></div>
    </div>
    <div ng-if="pagedata.order.isdiscountprice>0" class="fui-cell isdiscount">
        <div class="fui-cell-label" style='width:auto' >促销优惠</div>
        <div class="fui-cell-info"></div>
        <div class="fui-cell-remark noremark bold">-&yen; <span class='dispatchprice'>{{price(pagedata.order.isdiscountprice)}}</span></div>
    </div>

    <div ng-if="pagedata.saleset.enough.length>0" class="fui-cell" id="deductenough">
		<div class="fui-cell-label" style='width:auto' >商城优惠 <span style="font-size: .6rem">：单笔满 ￥<span id="deductenough_enough">{{pagedata.order.enough.man}}</span> 元立减￥{{pagedata.order.enough.jian}}</span></div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold">-&yen; <span class='dispatchprice'>{{price(pagedata.order.enough.jian)}}</span></div>
	</div>

	<div ng-if="pagedata.order.sale_enough.length>0" class="fui-cell" id="merch_deductenough">
		<div class="fui-cell-label" style='width:auto' >单笔满 <span id="merch_deductenough_enough" class='text-danger'>{{pagedata.order.sale_enough[0].man}}</span> 元立减</div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold">-&yen; <span class='dispatchprice'>{{price(pagedata.order.sale_enough[0].jian)}}</span></div>
	</div>

	<div ng-if="pagedata.order.seckillprice" class="fui-cell" id="seckillprice">
		<div class="fui-cell-label" style='width:auto' >秒杀优惠</div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold">-&yen; <span class='dispatchprice'>{{price(pagedata.order.seckillprice)}}</span></div>
	</div>
	<div ng-if="pagedata.order.packageprice" class="fui-cell" id="showpackageprice">
		<div class="fui-cell-label" >套餐优惠</div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold">
			&yen; <span class='packageprice'>-{{price(pagedata.order.packageprice)}}</span>
		</div>
	</div>
	<div ng-if="pagedata.post.couponid" class="fui-cell">
		<div class="fui-cell-label" style='width:auto' >{{pagedata.post.title5}}(优惠券)</div>
		<div class="fui-cell-info"></div>
		<div ng-if="pagedata.post.backtype!=1" class="fui-cell-remark noremark bold">-&yen; <span class='dispatchprice'>{{pagedata.post.deduct}}</span></div>
		<div ng-if="pagedata.post.backtype==1" class="fui-cell-remark noremark bold"><span class='dispatchprice'>{{pagedata.post.discount}}</span>折</div>
	</div>
	<div ng-if="pagedata.post.sendtype==1" class="fui-cell" id="showdispatchprice">
		<div class="fui-cell-label" style="width:auto">{{pagedata.order.baoyou_man>0 && pagedata.order.total_price>=pagedata.order.baoyou_man?'满'+pagedata.order.baoyou_man+'免配送费':'配送费'}}:({{pagedata.order.peisong_juli}}km)</div>
		<div class="fui-cell-info"><span ng-if="pagedata.order.teshufee>0" class="subtitle">恶劣环境费￥{{pagedata.order.teshufee}}</span><span ng-if="pagedata.order.lateye_fee>0" class="subtitle">深夜费￥{{pagedata.order.lateye_fee}}</span></div>
		<div class="fui-cell-remark noremark bold">&yen; 
		<span class="dispatchprice">{{price(pagedata.order.dispatchprice) || '0.00'}}</span>
		<span ng-if="pagedata.order.isonebaoyou" class="subtitle">部分免邮</span> <span ng-if="pagedata.order.addbaoyoufee>0" class="delete">免{{price(pagedata.order.addbaoyoufee) || '0.00'}}</span>
		</div>
	</div>
	<div ng-if="pagedata.order.out_upfee>0" class="fui-cell">
		<div class="fui-cell-label">打包费</div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold">
			<span class='dispatchprice'>￥{{pagedata.order.out_upfee}}</span>
		</div>
	</div>
	<div ng-if="pagedata.post.make_type==0 && pagedata.selectstore.out_feejia" class="fui-cell">
		<div class="fui-cell-label">加急费</div>
		<div class="fui-cell-info"></div>
		<div class="fui-cell-remark noremark bold">
			&yen; <span class='dispatchprice'>{{price(pagedata.selectstore.out_feejia)}}</span>
		</div>
	</div>
</div>
<div ng-if="pagedata.post.sendtype==2 && pagedata.isareadian==1" class="fui-cell-group" style="padding:0 0.65rem;padding-bottom:1rem">
		<div class="fui-cell-title bold" style="padding: 0.5rem 0rem;">{{pagedata.pluginset.qucaititle}}方式</div>
		<div class="col-jy-2" style="padding:0">
					<a href="javascript:;" ng-click="pagedata.post.self_type=1" ng-class="{'fui-btn-c jylabel jylabel-red-0':1, 'active':pagedata.post.self_type==1}" style="border-top-right-radius:0;border-bottom-right-radius:0;border-top-left-radius:0.3rem;border-bottom-left-radius:0.3rem;">
						<i class="icon icon-peisong"></i>
						<div class="info"><div class="bold" style="line-height:1">店内{{pagedata.pluginset.qucaititle}}</div><div style="line-height:1">Dine IN</div></div>
					</a>
		</div>
		<div class="col-jy-2" style="padding:0">
					<a href="javascript:;" ng-click="pagedata.post.self_type=0" ng-class="{'fui-btn-c jylabel jylabel-red-0':1, 'active':pagedata.post.self_type==0}" style="border-top-right-radius:0.3rem;border-bottom-right-radius:0.3rem;border-top-left-radius:0;border-bottom-left-radius:0;">
						<i class="icon icon-gifts"></i>
						<div class="info"><div class="bold" style="line-height:1">配点{{pagedata.pluginset.qucaititle}}</div><div style="line-height:1">Take Away</div></div>
					</a>
		</div>
</div>
<div ng-if="pagedata.post.sendtype==1 && pagedata.citypeisong.isopen==1" class="fui-cell-group" style="padding:0 0.65rem;padding-bottom:1rem">
		<div class="fui-cell-title bold" style="padding: 0.5rem 0rem;">配送时间</div>
		<div class="col-jy-2" style="padding:0">
					<a href="javascript:;" ng-click="pagedata.post.make_type=0" ng-class="{'fui-btn-c jylabel jylabel-red-0':1, 'active':pagedata.post.make_type==0}" style="border-top-right-radius:0;border-bottom-right-radius:0;border-top-left-radius:0.3rem;border-bottom-left-radius:0.3rem;">
						<i class="icon icon-peisong"></i>
						<div class="info"><div class="bold" style="line-height:1">{{pagedata.pluginset.on_feejia==1?'加急配送':'立即配送'}}</div><div style="line-height:1">Dine IN</div></div>
					</a>
		</div>
		<div ng-if="pagedata.citypeisong.no_yuyuepei!=1" class="col-jy-2">
					<a href="javascript:;" ng-click="pagedata.selecttime();pagedata.post.make_type=1"  ng-class="{'fui-btn-c jylabel jylabel-red-0':1, 'active':pagedata.post.make_type==1}">
						<i class="icon icon-daishouhuo1"></i>
						<div class="info"><div class="bold" style="line-height:1">预约配送</div>
							<div ng-if="!pagedata.post.out_time" style="line-height:1">Take Away</div>
							<div ng-if="pagedata.post.out_time" style="line-height:1;font-size:0.6rem">约{{pagedata.post.out_time}}送达</div>
						</div>
					</a>
		</div>
</div>
<div ng-if="pagedata.post.sendtype==3" class="fui-cell-group" style="padding:0 0.65rem;padding-bottom:1rem">
		<div class="fui-cell-title bold" style="padding: 0.5rem 0rem;">预约自取时间</div>
		<div class="col-jy-2">
					<a href="javascript:;" ng-click="pagedata.selecttime();pagedata.post.make_type=1"  class="fui-btn-c jylabel jylabel-red-0 active">
						<i class="icon icon-daishouhuo1"></i>
						<div class="info"><div class="bold" style="line-height:1">预约自取</div>
							<div ng-if="!pagedata.post.out_time" style="line-height:1">Take Away</div>
							<div ng-if="pagedata.post.out_time" style="line-height:1;font-size:0.6rem">约{{pagedata.post.out_time}}自取</div>
						</div>
					</a>
		</div>
</div>
<div id="showdelivery"  class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
	<div class="modal-dialog" style="width:100%;left:0;bottom:0;">
		<div class="modal-bottom">
			<div class="fui-cell-group">
				<div class="fui-cell">
					<div class="fui-cell-label" style="width:100px;font-size:0.9rem">配送</div>
				</div>
				<div class="fui-cell">
					<div class="tag">
						<span ng-class="{'fui-tag fuilabel fuilabel-red-0 sale-tip':1,'active':pagedata.post.sendtype==1}" style="margin-right:10px;" ng-click="pagedata.post.sendtype=1">快递配送</span><span ng-class="{'fui-tag fuilabel fuilabel-red-0 sale-tip':1,'active':pagedata.post.sendtype==2}" style="margin-right:10px;" ng-click="pagedata.post.sendtype=2">店内就餐</span>
					</div>
				</div>
			</div>
			<div ng-if="pagedata.post.sendtype !=2" class="fui-cell-group" style="margin-top:-10px">
					<div class="fui-cell">
						<div class="fui-cell-label" style="width:100px">送达时间</div>
						<div class="fui-cell-text bold r"><span class="red">预计</span>({{pagedata.post.deliverytime}}送达)</div>
						<div class="fui-cell-remark" onclick="$('#showsendtime').modal();" ng-click=""></div>
					</div>
			</div>
			<div ng-if="pagedata.post.sendtype ==2" class="fui-cell-group" style="margin-top:-10px">
					<div class="fui-cell">
						<div class="fui-cell-label" style="width:100px">自提地点</div>
						<div class="fui-cell-text bold r"><span class="red">{{pagedata.selectstore.pcd.city}}</span>({{pagedata.selectstore.pcd.district}} {{pagedata.selectstore.pcd.street}} {{pagedata.selectstore.address}})</div>
						<div class="fui-cell-remark" ng-click="pagedata.showstorelist();"></div>
					</div>
			</div>
			<div class="fui-navbar">
				<a aria-hidden="true" data-dismiss="modal" href="javascript:;" class="nav-item btn btn-danger confirmbtn">确定</a>
			</div>
		</div>
	</div>
</div>
<div id="showfapiao"  class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
	<div class="modal-dialog" style="width:100%;left:0;bottom:0">
		<div class="modal-bottom">
			<div class="fui-cell-group" style="padding-bottom:2.5rem">
				<div class="fui-cell">
					<div class="fui-cell-label" style="width:100px;font-size:0.9rem">发票</div>
				</div>
				<div class="fui-cell noborder" style="">
					<div class="fui-cell-label bold" style="width:100px;font-size:0.6rem">发票类型</div>
				</div>
				<div class="fui-cell" style="margin-top:-10px">
					<div class="tag">
						<div style="width:100%">
							<span ng-class="{'fui-tag fuilabel fuilabel-red-0 sale-tip':1,'active':pagedata.post.invoicetype !=2}" style="margin-right:10px;" ng-click="pagedata.post.invoicetype=1">电子普通发布</span><span ng-class="{'fui-tag fuilabel fuilabel-red-0 sale-tip':1,'active':pagedata.post.invoicetype==2}" style="margin-right:10px;" ng-click="pagedata.post.invoicetype=2">增值税专用发票</span>
						</div>
						<div class="fui-cell-help">电子普通发票与纸质普通发票具备同等法律效力，可支持报销入账。</div>
					</div>
				</div>
				<div class="fui-cell noborder" style="">
					<div class="fui-cell-label bold" style="width:100px;font-size:0.6rem">发票抬头</div>
				</div>
				<div class="fui-cell" style="margin-top:-10px">
					<div class="tag">
						<div style="width:100%">
							<span ng-class="{'fui-tag fuilabel fuilabel-red-0 sale-tip':1,'active':pagedata.post.fapiaotype2 !=2}" style="margin-right:10px;" ng-click="pagedata.post.fapiaotype2=1;pagedata.post.invoicename=pagedata.item.address.name">个人</span><span ng-class="{'fui-tag fuilabel fuilabel-red-0 sale-tip':1,'active':pagedata.post.fapiaotype2==2}" style="margin-right:10px;" ng-click="pagedata.post.fapiaotype2=2">单位</span>
						</div>
						<div class="fui-cell-info"><input type="text" placeholder="填写抬头，姓名" class="fui-input" ng-model="pagedata.post.invoicename"/></div>
						<div class="fui-cell-info" ng-if="pagedata.post.fapiaotype2 ==2"><input type="text" placeholder="填写税号" class="fui-input" ng-model="pagedata.post.invoicecode"/></div>
					</div>
				</div>
				<div class="fui-cell noborder" style="">
					<div class="fui-cell-label bold" style="width:100px;font-size:0.6rem">收票人信息</div>
				</div>
				<div class="fui-cell sm-cell">
					<div class="fui-cell-label" style="width:80px;">收票人名称</div>
					<div class="fui-cell-info">{{pagedata.item.address.name}}</div>				
				</div>
				<div class="fui-cell sm-cell">
					<div class="fui-cell-label" style="width:80px;">收票人手机</div>
					<div class="fui-cell-info">{{pagedata.item.address.mobile}}</div>				
				</div>
				<div class="fui-cell sm-cell">
					<div class="fui-cell-label " style="width:80px;">收票人邮箱</div>
					<div class="fui-cell-info"><input type="text" placeholder="用来接收电子发票邮箱，可选填" class="fui-input" ng-model="pagedata.post.email"/></div>
				</div>
				<div class="fui-cell noborder">
					<div class="fui-cell-label bold" style="width:80px;">收票人内容</div>
					<div class="fui-cell-info">发票内容选项已根据税法调整，具体请以展示为准</div>
				</div>
				<div class="fui-cell sm-cell">
					<div class="tag">
						<div style="width:100%">
							<span ng-class="{'fui-tag fuilabel fuilabel-red-0 sale-tip':1,'active':pagedata.post.invoicegoodstype !=2}" style="margin-right:10px;" ng-click="pagedata.post.invoicegoodstype=1">商品明细</span><span ng-class="{'fui-tag fuilabel fuilabel-red-0 sale-tip':1,'active':pagedata.post.invoicegoodstype==2}" style="margin-right:10px;" ng-click="pagedata.post.invoicegoodstype=2">商品类别</span>
						</div>
						<div class="fui-cell-help" ng-if="pagedata.post.invoicegoodstype !=2">发票内容将显示详细商品名称与价格信息</div>
						<div class="fui-cell-help" ng-if="pagedata.post.invoicegoodstype ==2">发票内容将显示本商品所属类别及价格详情</div>
					</div>
				</div>
			</div>
			<div class="fui-navbar">
				<a href="javascript:;" aria-hidden="true" data-dismiss="modal" class="nav-item btn btn-danger confirmbtn">确定</a>
			</div>
		</div>
	</div>
</div>
<div id="showcoupon"  class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
	<div class="modal-dialog" style="width:100%;left:0;bottom:0">
		<div class="modal-bottom">
			<div ng-include="sys_html('coupon/common/_picker','','','jy_weishop')"></div>
		</div>
	</div>
</div>
<div id="showremark"  class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
	<div class="modal-dialog" style="width:100%;left:0;bottom:0">
		<div class="modal-bottom">
			<div class="fui-cell-group">
				<div class="fui-cell">
					<div class="fui-cell-label" style="width:100px;font-size:0.9rem">留言</div>
				</div>
				<div class="fui-cell">
					<div class="fui-cell-info c000">
						<textarea rows="5" placeholder="50字以内（选填）" ng-model="pagedata.post.remark"></textarea>
					</div>
				</div>
			</div>
			<div class="fui-navbar">
				<a href="javascript:;"  aria-hidden="true" data-dismiss="modal" class="nav-item btn btn-danger confirmbtn">确定</a>
			</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.modal_address==1" class="popup">
	<div class="popup-body">
		<div class="popup-bottom" style="padding-bottom:2.5rem">
		<i class="closed icon icon-close" style="color:red;top:0.3rem" ng-click="pagedata.modal_address=0"></i>
		<div class="fui-list-group modal-swiper-y" style='margin-top:5px;background:#fff'>
			<div class="fui-list address-item" ng-repeat="item in pagedata.address_list">
				
				<div class="fui-list-inner">
					<div class="title" ng-click="pagedata.change_address(item)"><span class='realname'>{{item.name}}</span> <span class='mobile'>{{item.mobile}}</span></div>
					<div class="text" ng-click="pagedata.change_address(item)"><span class='address'>{{item.pcd.province}} {{item.pcd.city}} {{item.pcd.district}} {{item.address}}</span></div>
					<div class='bar' >
						<span class='pull-right'>
							<a class="external" href="javascript:;" ng-click="pagedata.edit_address=1;pagedata.item.address=item;pagedata.isaddaddress=0">
							<i class='icon icon-bianji'></i> 编辑
							</a>
							<a class='external' href="javascript:;" ng-click="pagedata.del_address($index)">
							<i class='icon icon-shanchu'></i> 删除
							</a>
						</span>
						<label class='radio-inline'  ng-click="pagedata.setaddress($index);pagedata.change_address(item)">
							<input type="radio" class="fui-radio  fui-radio-danger" ng-checked="item.isdefault==1"/> 设置默认
						</label>
					</div>
				</div>
			</div>
		</div>
		<div class='fui-navbar'>
			<a class="nav-item btn btn-danger external" ng-click="pagedata.item.address.address='';pagedata.edit_address=1;pagedata.isaddaddress=1"><i class="icon icon-tianjia" style="font-size:32rpx"></i> 添加地址</a>
		</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.edit_address==1" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<div class='fui-cell-group modal-swiper-y' style="height: 18rem;padding-bottom:2.5rem">
				<div class="fui-cell">
					<div class="fui-cell-label" style="width:100px;font-size:0.9rem">添加地址</div>
				</div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>收件人</div>
                    <div class='fui-cell-info'><input type="text" ng-model="pagedata.item.address.name" placeholder="收件人" class="fui-input"/></div>
                </div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>联系电话</div>
                    <div class='fui-cell-info'><input type="tel" ng-model="pagedata.item.address.mobile" placeholder="联系电话"  class="fui-input"/></div>
                </div>
                <div class="fui-cell">
					<div class="fui-cell-label">地区设置</div>
					<div class="fui-cell-info">{{pagedata.item.address.pcd.province||'省'}},{{pagedata.item.address.pcd.city||'城市'}},{{pagedata.item.address.pcd.district||'区域'}},{{pagedata.item.address.pcd.street||'街道'}}</div>
					<div class="fui-cell-remark noremark" ng-click="tool.choose_location(pagedata.item,'address','',true)"><i class="icon icon-ditu syscolor">点击获取</i></div>
				</div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>详细地址</div>
                    <div class='fui-cell-info'><input type="text" ng-model="pagedata.item.address.address" placeholder='街道，楼牌号等'  class="fui-input"/></div>
                </div>
            </div>
			<div class="fui-navbar">
				<a href="javascript:;" ng-click="pagedata.add_address();pagedata.edit_address=0" class="nav-item btn btn-danger confirmbtn">确定</a>
			</div>
			<i ng-click="pagedata.edit_address=0" class="closed icon icon-cuowu"></i>
		</div>
	</div>
</div>
<div ng-if="pagedata.is_moregoods!=1" class="fui-footer quick" style="">
			<div class="quick-cart c" style="" ng-click="access_json('jy_kefu/home//p=jy_merch&pid='+pagedata.selectstore.id)">
				<i class="icon icon-lianxishangjia" style="font-size:1.2rem"></i>
				<div class="c" style="font-size:0.5rem;margin-top:-0.3rem">联系商家</div>
			</div>
			<div class="quick-info" style="">
				<div ng-if="pagedata.post.total>0" class="dot2" style="display: block; top:0;">{{pagedata.post.total}}</div>
				<i ng-if="pagedata.post.sendtype==1" ng-class="{'icon icon-peisong':1,'yellow2':pagedata.post.total>0}" style="line-height:2.5rem;padding:0.3rem 0.5rem;font-size:3rem;"></i>
				<i ng-if="pagedata.post.sendtype!=1" ng-class="{'icon icon-ziqu':1,'yellow2':pagedata.post.total>0}" style="line-height:2.5rem;padding:0.3rem 0;font-size:3rem;"></i>
				<div style="margin-left:4rem;color:#ffcb51">
					<div style="line-height:1rem;height:1rem">￥<span style="font-size:1rem;font-weight:400">{{pagedata.post.sendtype==1?pagedata.post.endprice:pagedata.post.no_dispatch_price}}</span></div>
					<div ng-if="pagedata.post.sendtype==1" style="line-height:1rem;height:1rem;color:#9e9e9e;font-size:0.5rem">含配送费￥<span style="font-weight:400">{{pagedata.order.dispatchprice || '0.00'}}</span></div>
					<div ng-if="pagedata.post.sendtype!=1" style="line-height:1rem;height:1rem;color:#9e9e9e;font-size:0.5rem">自助提取</div>
				</div>
			</div>
			<div ng-if="!pagedata.post.total || (pagedata.selectstore.out_price>pagedata.order.total_price && pagedata.post.sendtype ==1)" class="quick-submit remark" style="background: #000;color:#9e9e9e;">
				<span>¥{{pagedata.selectstore.out_price || '10.00'}}起送 </span> 
			</div>
			<div ng-if="pagedata.peerpay && !pagedata.order_id && pagedata.post.total>0 && (pagedata.order.outarea!=1 || pagedata.post.sendtype !=1) && (pagedata.selectstore.out_price<=pagedata.order.total_price || pagedata.post.sendtype !=1)" href="javascript:;" ng-click="pagedata.post.peerpay=true;pagedata.pay_submit(pagedata.post,'post','/orderlist//fromcreate=1')"  class="quick-submit remark bold" style="background:#fcdf9c;border-radius:0;padding:0 0.3rem">
				找代付
			</div>
			<div ng-if="!pagedata.order_id && pagedata.post.total>0 && (pagedata.order.outarea!=1 || pagedata.post.sendtype !=1) && (pagedata.selectstore.out_price<=pagedata.order.total_price || pagedata.post.sendtype !=1)" href="javascript:;" ng-click="pagedata.pay_submit(pagedata.post,'post','/orderlist//fromcreate=1')"  class="quick-submit remark bold" style="">
				{{pagedata.peerpay?'结算':'去结算'}}
			</div>
			<div ng-if="pagedata.order_id && pagedata.post.total>0 && (pagedata.order.outarea!=1 || pagedata.post.sendtype !=1)" href="javascript:;" ng-click="access_json('jy_weishopmeituan/orderdetail//id='+pagedata.order_id+'&fromcreate=1')"  class="quick-submit remark bold" style="">
				查看订单
			</div>
			<div ng-if="pagedata.post.total>0 && pagedata.order.outarea==1 && pagedata.post.sendtype ==1 && pagedata.selectstore.out_price<=pagedata.order.total_price" class="quick-submit remark bold" style="background: #000;color:#9e9e9e;">
				超出配送范围
			</div>
</div>
<div ng-if="pagedata.is_moregoods==1" class="fui-navbar order-create-checkout">
    <a href="javascript:;" class="nav-item total" style="text-align:left;padding-left:0.5rem">
        <span ng-show="pagedata.post.sendtype==1" class="text-danger bigprice">&yen; 
			<span class="totalprice" style="font-size:1.2rem">{{price(pagedata.post.endprice) || '0.00'}}</span>
		</span>
		<span ng-show="pagedata.post.sendtype!=1" class="text-danger bigprice">&yen; 
			<span class="totalprice" style="font-size:1.2rem">{{price(pagedata.post.no_dispatch_price) || '0.00'}}</span>
		</span>
    </a>
	<a ng-if="!pagedata.order.id || pagedata.order.status==0" href="javascript:;" class="nav-item btn buybtn" ng-click="access_json('jy_weishopmeituan/merchitem//id='+pagedata.order.merchid+'&orderid='+pagedata.order.id);">	
		<div class="fee-tag-nav">
			{{(!pagedata.order.id || pagedata.order.cart_num>0)?'返回看看':'追加+'}}
		</div>
	</a>
    <a href="javascript:;" class="nav-item btn buybtn" ng-if="!pagedata.order_id && ((pagedata.order.no_out_price==0 && pagedata.order.outarea!=1) || pagedata.post.sendtype!=1)" ng-click="pagedata.pay_submit(pagedata.post,'jy_weishopmeituan/create/post/','/order.list//fromcreate=1')" >
		<div class="fee-tagup-nav">
			确认下单
		</div>
	</a>
	<a ng-if="pagedata.order.id && pagedata.order.cart_num>0" href="javascript:;" class="nav-item btn btn-danger buybtn" ng-click="pagedata.pay_submit(pagedata.post,'jy_weishopmeituan/create/post/','/orderlist//fromcreate=1')" >
		<div class="fee-tagup-nav">
			确认追加
		</div>
	</a>
	<a ng-if="pagedata.order_id && (pagedata.order.cart_num<=0||!pagedata.order.cart_num)" href="javascript:;" class="nav-item btn btn-danger buybtn" ng-click="pagedata.pay_check(pagedata.order_id)" >
		<div class="fee-tag-nav">
			支付订单
		</div>
	</a>
	<a href="javascript:;" class="nav-item btn buybtn" ng-if="(pagedata.order.no_out_price>0 || pagedata.order.outarea==1) && pagedata.post.sendtype==1">
		<div class="fee-disabled-nav">
			<span ng-if="pagedata.order.no_out_price>0 && pagedata.order.outarea!=1 && pagedata.order.isnocity!=1">满{{pagedata.order.no_out_price}}元起送</span>
			<span ng-if="pagedata.order.outarea==1 || pagedata.order.isnocity==1">{{pagedata.order.isnocity==1?'不在同城':'超出配送范围'}}</span>
			{{pagedata.order.maxout_juli && pagedata.order.isnocity==1 ?pagedata.order.maxout_juli+'km':''}}
		</div>
	</a>
</div>
<div id="showstoreitem"  class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
	<div class="modal-dialog" style="width:100%;left:0;bottom:0">
		<div class="modal-bottom">
			<div class="fui-cell-group">
				<div class="fui-cell">
					<div class="fui-cell-label" style="width:100px;font-size:0.9rem">{{pagedata.storeitem.title}}</div>
				</div>
				<div class="fui-cell noborder">
					<div class="fui-cell-label bold" style="width:80px;">地址：</div>
					<div class="fui-cell-info">{{pagedata.storeitem.pcd.province}} {{pagedata.storeitem.pcd.city}} {{pagedata.storeitem.pcd.district}} {{pagedata.storeitem.pcd.street}} {{pagedata.storeitem.address}}</div>
				</div>
				<div class="fui-cell noborder">
					<div class="fui-cell-label bold" style="width:80px;">联系人：</div>
					<div class="fui-cell-info">{{pagedata.storeitem.realname}}</div>
				</div>
				<div class="fui-cell noborder">
					<div class="fui-cell-label bold" style="width:80px;">联系电话：</div>
					<div class="fui-cell-info">{{pagedata.storeitem.mobile}}</div>
				</div>
			</div>
			<div class="fui-navbar">
				<a href="javascript:;"  aria-hidden="true" data-dismiss="modal" class="nav-item btn btn-danger confirmbtn">关闭</a>
			</div>
		</div>
	</div>
</div>
<!-- 放弃付款-->
<div ng-if="pagedata.checkcancel" class="popup">
			<div class="popup-body">
			<div class="popup-center" style="border-radius:0.2rem;">
				<div class="fui-page-title" style="margin-top:1rem">确定要取消订单吗？</div>
				<div class="fui-page-subtitle" style="margin-top:0.1rem">喜欢的商品可能随时会被抢空哦</div>
				<div class="modal-footer" style="margin-top:2rem">
					<a ng-click="pagedata.checkcancel=false" class="mod-fail">取消</a>
					<a href="javascript:" ng-click="post({},'cancel','id='+pagedata.order.id);pagedata.checkcancel=false" class="mod-success" style="background:red">确定</a>
				</div>
			</div>
			</div>
</div>
<div id="selecttime" class="modal fade" tabindex="-1" style="z-index: 99999; display: none;">
	<div class="modal-dialog" style="width:100%;bottom:0%;left:0%;">
	<div class="modal-content" style="border-radius: 4px;">
		<div aria-hidden="true" data-dismiss="modal" class="closebtn" style="color:#ddd;top:0.2rem;right:0.2rem"><i class="icon icon-wrong" style="font-size:1.3rem;"></i></div>
		<div class="fui-line" style="width:6rem;margin:0.5rem auto 0 auto">
			<div class="text red" style="background-color:#fff" >请选择{{pagedata.post.sendtype==3?'自取':'送达'}}时间</div>
		</div>
		<div class="row margin0">
			<div class="col-xs-3">
				<div class="parent-category" id="delivery-time-parent">
					<ul>
							<li ng-class="{'active':pagedata.post.dayid==$index}" ng-repeat="(key,value) in pagedata.out_time.days"><a href="javascript:;" ng-click="pagedata.post.dayid=$index">{{value}}</a></li>
					</ul>
				</div>
			</div>
			<div class="col-xs-9" style="padding-left:0;padding-bottom:1rem">
				<div class="children-category" id="delivery-time-children">
					<div class="children-category-wrapper">
						<ul id="category1" aria-hidden="true" data-dismiss="modal" style="height:19rem">
								<li ng-show="pagedata.out_time.lasttimebox != 0 || pagedata.post.dayid!=0" class="time-flag"><a href="javascript:;" ng-click="pagedata.post.out_time=item.predict_time">尽快{{pagedata.post.sendtype==3?'自取':'送达'}} <span ng-if="pagedata.post.sendtype!=3">(配送费￥{{pagedata.out_time.times[0].out_pay}})</span></a></li>
								<li ng-show="pagedata.out_time.lasttimebox != 0 || pagedata.post.dayid!=0" class="delivery-tips time-flag" style="color:#ffa000">约{{pagedata.predict_time}}{{pagedata.post.sendtype==3?'自取':'送达'}}</li>
								<li ng-repeat="item in pagedata.out_time.times" ng-click="pagedata.post.out_time=item.timev" ng-class="{'hide init-hide':(item.timestamp <= pagedata.timestamp && pagedata.post.dayid==0)}">
									<a href="javascript:;">{{item.timev}} <span ng-if="pagedata.post.sendtype!=3">({{item.out_pay}})</span></a>
								</li>
								<div class="content-empty" ng-show="pagedata.out_time.lasttimebox == 0 && pagedata.post.dayid==0">
									  <i class="icon jinyunicon icon-cry" style="width: 6rem;margin-bottom: 0.5rem;"></i><br/><p style="color: #999;font-size: .75rem">当天没有{{pagedata.post.sendtype==3?'自取':'送达'}}时间段！</p>
								</div>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
	</div>
</div>
<div ng-include="sys_html('common/_footer')"></div>
</div>
</div>
<script language='javascript'>
scope.pagedata.pay_submit=function(post,post_url,complete_url){
	post.peisong_juli=scope.pagedata.order.peisong_juli
	scope.post_json(post_url,post,function(result){
		scope.pagedata.order_id=result.order_id;
		complete_url='/orderdetail//fromcreate=1&payid='+result.pay_id
		scope.$evalAsync();
		if(scope.pagedata.is_moregoods!=1){
		scope.tool.pay(result.pay_id,function(res){
				if(res.type=='success'){
					scope.message(res.message,'success',complete_url);
				}else{
					scope.message(res.message,'success',complete_url);
				}
		},'','',complete_url);
		}else{
			scope.message('下单成功！','success','jy_weishopmeituan/create//id='+result.order_id);
		}
	});
}
// 根据收货地址获取经纬度
scope.pagedata.get_latlng=function(){
	scope.pagedata.item.address.pcd=scope.pagedata.item.address.pcd?scope.pagedata.item.address.pcd:{}
	var addressitem=scope.pagedata.item.address.pcd.province+' '+scope.pagedata.item.address.pcd.city+' '+scope.pagedata.item.address.pcd.district+' '+scope.pagedata.item.address.address;
	var post={
		'address':addressitem,
		'city':scope.pagedata.item.address.pcd.city,
	}
	scope.tool.get_latlng(post,function(res){
		if(!res){
			return;
		}
		var lat_lng=res.location;
		scope.pagedata.post.real_lat_lng=lat_lng
		scope.get('jy_merch/myshop/get_juli/merchid='+scope.pagedata.post.merchid+'&lat='+lat_lng.lat+'&lng='+lat_lng.lng,function(juli){
			scope.pagedata.post.real_juli=juli>0?juli:scope.pagedata.order.peisong_juli;
			if(scope.pagedata.post.real_juli>0 && scope.pagedata.selectstore.out_juli>=scope.pagedata.post.real_juli || scope.pagedata.post.sendtype !=1){
				scope.pagedata.order.outarea=0;
			}else{
				scope.pagedata.order.outarea=1;
			}
			if(scope.pagedata.selectstore.out_juli>0 && scope.pagedata.selectstore.out_juli<scope.pagedata.post.real_juli){
				scope.message('超出配送范围，您可以选择其他附近的商铺！');
			}
			scope.$evalAsync();
		});
	});
}
//scope.pagedata.get_latlng();
scope.pagedata.setaddress=function(index){
	var id =scope.pagedata.address_list[index].id
	scope.get('core/member.address/set/id='+id+'&get=1',function(res){
		for(var i in scope.pagedata.address_list){
				scope.pagedata.address_list[i].isdefault=0
		}
		scope.pagedata.address_list[index].isdefault=1
		scope.pagedata.post.addressid=id
		scope.pagedata.modal_address=0;
		scope.message('设置成功');
		scope.$evalAsync();
	});
}
scope.pagedata.del_address=function(index){
	var id =scope.pagedata.address_list[index].id
	console.log(id);
	scope.get('core/member.address/del/id='+id+'&get=1',function(res){
		scope.pagedata.address_list.splice(index,1);
		scope.message('删除成功');
		scope.$evalAsync();
	});
}
scope.pagedata.get_addresslist=function(){
	scope.pagedata.item.address.res=1
	scope.get('core/member.address/',function(res){
		scope.pagedata.address_list=res.list;
		scope.pagedata.modal_address=1;
		scope.$evalAsync();	
	});
}
scope.pagedata.add_address=function(){
	scope.pagedata.item.address.res=1
	var post=scope.pagedata.item.address;
	console.log(post);
	if(scope.pagedata.isaddaddress==1){
		post.id='';
		post.isdefault=0;
	}
	scope.post_json('core/member.address/post/',post,function(res){
			//console.log(res);
			scope.pagedata.post.addressid =res;
			post.id=post.id?post.id:res;
			scope.pagedata.address_list.push(post);
			scope.pagedata.get_latlng();
			$('#modal_address').modal('hide');
			scope.get('jy_weishop/order.create/get_freight/showbaoyou=1&addressid='+scope.pagedata.post.addressid+'&merchid='+scope.pagedata.post.merchid,function(freight){
				//console.log(freight);
				scope.pagedata.post.endprice=parseFloat(scope.pagedata.post.endprice)-parseFloat(scope.pagedata.order.dispatchprice)+parseFloat(freight.fee);
				if(scope.pagedata.order.last_cardfee>0 && scope.pagedata.order.no_di_cardfee!=1){
					scope.pagedata.post.endprice -=scope.pagedata.order.last_cardfee;
				}
				scope.pagedata.order.dispatchprice=freight.fee;
				scope.pagedata.post.dispatchprice=freight.fee;
				scope.pagedata.order.addbaoyoufee=freight.addbaoyoufee;
				scope.pagedata.order.isonebaoyou=freight.isonebaoyou;
				scope.pagedata.edit_address=0;
				scope.pagedata.modal_address=0;
				scope.pagedata.order.is_peisong=freight.is_peisong==1?freight.is_peisong:0;
				scope.pagedata.post.is_peisong=scope.pagedata.order.is_peisong;
				if(scope.pagedata.sendtypes && scope.pagedata.sendtypes[1]){
					scope.pagedata.sendtypes[1]=scope.pagedata.order.is_peisong==1?'同城配送':'快递配送';
				}
				if(scope.pagedata.post.endprice<=0){
					scope.pagedata.post.endprice=0.00;
				}
				scope.pagedata.order.outarea=freight.outarea;
				scope.pagedata.order.isnocity=freight.iscity==1?0:1;
				scope.pagedata.order.no_out_price=freight.no_out_price?freight.no_out_price:0;
				scope.pagedata.order.baoyou_man=freight.baoyou_man?freight.baoyou_man:0;
				scope.pagedata.order.peisong_juli=freight.juli?freight.juli:scope.pagedata.order.peisong_juli;
				scope.$evalAsync();
				$('#modal_address').modal('hide');
			});
	});
}
scope.pagedata.change_address=function(res){
	console.log(res);
	scope.pagedata.item.address=res;
	scope.pagedata.post.addressid=res.id;
	scope.pagedata.get_latlng();
	scope.pagedata.modal_address=0
	//配送费固定
	scope.$evalAsync();
	scope.get('jy_weishop/order.create/get_freight/showbaoyou=1&addressid='+scope.pagedata.post.addressid+'&merchid='+scope.pagedata.post.merchid,function(freight){
				scope.pagedata.post.endprice=parseFloat(scope.pagedata.post.endprice)-parseFloat(scope.pagedata.order.dispatchprice)+parseFloat(freight.fee);
				if(scope.pagedata.order.last_cardfee>0 && scope.pagedata.order.no_di_cardfee!=1){
					scope.pagedata.post.endprice -=scope.pagedata.order.last_cardfee;
				}
				scope.pagedata.order.dispatchprice=freight.fee;
				scope.pagedata.post.dispatchprice=freight.fee;
				scope.pagedata.order.addbaoyoufee=freight.addbaoyoufee;
				scope.pagedata.order.isonebaoyou=freight.isonebaoyou;
				scope.pagedata.modal_address=0;
				scope.pagedata.order.is_peisong=freight.is_peisong==1?freight.is_peisong:0;
				scope.pagedata.post.is_peisong=scope.pagedata.order.is_peisong;
				if(scope.pagedata.sendtypes && scope.pagedata.sendtypes[1]){
					scope.pagedata.sendtypes[1]=scope.pagedata.order.is_peisong==1?'同城配送':'快递配送';
				}
				if(scope.pagedata.post.endprice<=0){
					scope.pagedata.post.endprice=0.00;
				}
				scope.pagedata.order.outarea=freight.outarea;
				scope.pagedata.order.isnocity=freight.iscity==1?0:1;
				scope.pagedata.order.no_out_price=freight.no_out_price?freight.no_out_price:0;
				scope.pagedata.order.baoyou_man=freight.baoyou_man?freight.baoyou_man:0;
				scope.pagedata.order.peisong_juli=freight.juli?freight.juli:scope.pagedata.order.peisong_juli;
				scope.$evalAsync();
				$('#modal_address').modal('hide');
	});
}
scope.pagedata.showstoreitem=function(){
	$('#showstoreitem').modal();
}
scope.pagedata.checkcoupon=function(type){
	if(type){
		if(scope.pagedata.post.backtype!=1){
			scope.pagedata.post.no_dispatch_price = scope.pagedata.order.no_dispatch_price - scope.pagedata.order.coupon.deduct
			scope.pagedata.post.endprice = scope.pagedata.order.endprice - scope.pagedata.order.coupon.deduct
		}else{
			scope.pagedata.post.no_dispatch_price = scope.pagedata.order.no_dispatch_price * scope.pagedata.post.discount / 10;
			scope.pagedata.post.endprice = scope.pagedata.order.endprice * scope.pagedata.post.discount/10		
		}
	}else{
		scope.pagedata.post.couponid=0;
		if(scope.pagedata.post.backtype!=1){
			scope.pagedata.post.no_dispatch_price = scope.pagedata.order.no_dispatch_price
			scope.pagedata.post.endprice = scope.pagedata.order.endprice
		}else{
			scope.pagedata.post.no_dispatch_price = scope.pagedata.order.no_dispatch_price;
			scope.pagedata.post.endprice = scope.pagedata.order.endprice		
		}
	}
	$('#showcoupon').modal('hide');
	scope.$evalAsync();
}
scope.pagedata.selecttime=function(){
	$('#selecttime').modal();
	var merchid=scope.pagedata.post.merchid
	scope.get('jy_weishopmeituan/index/out_time/merchid='+merchid+'&out_pay='+scope.pagedata.order.dispatchprice,function(res){
		scope.pagedata.out_time=res.out_time;
		scope.pagedata.predict_time=res.predict_time;
		scope.pagedata.timestamp=res.timestamp;
		scope.$evalAsync();
	});
}
$("input,select").blur(function(){
        setTimeout(function() {
                var scrollHeight = document.documentElement.scrollTop || document.body.scrollTop || 0;
                window.scrollTo(0, Math.max(scrollHeight - 1, 0));
            }, 100);
})
scope.pagedata.pay_check=function(orderid){
	if(scope.pagedata.order.sendtype==1){
		scope.pay_submit({},'jy_weishopmeituan/create/pay/id='+orderid,'jy_weishopmeituan/orderlist//id='+orderid);
		return true;
	}
	scope.confirm({
		'message':'确认要现在买单吗？可以就餐后再买单的！',
		'success':function(){
			scope.pay_submit({},'jy_weishopmeituan/create/pay/id='+orderid,'jy_weishopmeituan/orderlist//id='+orderid);
		},
		'fail':function(){}
	});
}
scope.pagedata.getprovince=function(){
	scope.get('jy_weishop/get_data/getprovince/',function(res){
		scope.pagedata.province=res.province;
		scope.$evalAsync();
	});
}
//scope.pagedata.getprovince();
</script>